<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="__STATIC__/template/lib/html5shiv.js"></script>
    <script type="text/javascript" src="__STATIC__/template/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/template/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="__STATIC__/template/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <style>
        /*分页样式*/
        .pagination{text-align:center;margin-top:20px;margin-bottom: 20px;}
        .pagination li{margin:0px 10px; border:1px solid #e6e6e6;padding: 3px 8px;display: inline-block;}
        .pagination .active{background-color: #46A3FF;color: #fff;}
        .pagination .disabled{color:#aaa;}
        a:hover{color: #ff081f; /*鼠标在a上面时,变蓝色*/}
        select {
            /*Chrome和Firefox里面的边框是不一样的，所以复写了一下*/
            border: solid 1px #577d72;
            height: 32px;
            /*很关键：将默认的select选择框样式清除*/
            appearance:none;
            -moz-appearance:none;
            -webkit-appearance:none;

            /*在选择框的最右侧中间显示小箭头图片*/
            background: url("http://ourjs.github.io/static/2015/arrow.png") no-repeat scroll right center transparent;


            /*为下拉小箭头留出一点位置，避免被文字覆盖*/
            padding-right: 14px;
        }
        .groupxx{
            display: none;
        }
        .layer-photos-demo{
            cursor:pointer
        }

    </style>
    {load file='_CSS_/diyUpload.css'}
    {load file='_CSS_/webuploader.css'}
    <title>系统管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 系统管理
    <span class="c-gray en">&gt;</span> <span style="color:red;">申请成为合伙人列表</span>
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="l">
            <a class="btn btn-primary radius" data-title="高级合伙人设置" href="{:url('admin/System/senior')}">
                <i class="Hui-iconfont">&#xe72c;</i> 高级合伙人设置
            </a>
        </span>
      <!--  <span class="r">共有数据：<strong>{$count}</strong> 条-->
    </span>
    </div>
    <div class="mt-20">
        <table class="table table-border table-bordered table-bg table-hover  table-responsive">
            <thead>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="80">ID</th>
                <th width="180">标题</th>
                <th width="180">视频</th>
                <th width="120">操作</th>
            </tr>
            </thead>
            <tbody>
            {volist name='intro' id='v' empty='$empty'}
            <tr class="text-c">
                <td><input type="checkbox" value="{$v.id}" name=""></td>
                <td>{$v.id}</td>
                <td>{$v.title}</td>
                <td>
                    {empty name='$v.video'}
                    <span>暂无视频</span>
                    {else /}
                    <a style="cursor:pointer" class="text-primary" href="#"  title="">
                        <video width="100" height="100px" controls="controls" src="__VIDEO__/{$v.video}"></video>
                    </a>
                    {/empty}
                </td>
                <td class="f-14 td-manage">
                    <a style="text-decoration:none" class="ml-5" href="{:url(\'admin/System/partner\')}?id={$v.id}"  title="编辑">
                        <i class="Hui-iconfont">&#xe6df;</i>
                    </a>
                    <a style="text-decoration:none" class="ml-5" onClick="strategy_del(this,'{$v.id}')" href="javascript:;" title="删除">
                        <i class="Hui-iconfont">&#xe6e2;</i>
                    </a>
                </td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </div>

</div>
<form class="form form-horizontal" id="form-article-add">
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>标题：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <input type="text" class="input-text" value="{$result?$result.title:''}" placeholder="必填" id="title" name="title">
        </div>
    </div>

    <!--视频上传-->
    <div class="row cl">
        <label class="form-label col-xs-4 col-sm-2">视频：</label>
        <div class="formControls col-xs-8 col-sm-9">
            <div class="weui-uploader__bd video" id="video"></div>

            <span id="video_tip" style="vertical-align: middle;display: none" >视频上传格式只能为wmv,mp4(视频2~30M)</span>
            {notempty name='$result'}
                <div style="width:100px;height:100px;display: inline-block;text-align: center;">
                    <video controls="controls" src="__VIDEO__/{$result.video}" style="width:80px;height:80px;border-radius: 5px;border: 1px solid lightgrey"></video>
                    <a onclick="videoDel(this)" id="video_del" data-video="{$result?$result.video:''}" style="" href="javascript:;">
                        删除
                    </a>
                </div>
            {/notempty}

        </div>
    </div>
    <!--图片上传-->
    <div class="row cl">
        <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
            {empty name='result'}
            <button onClick="strategy_save_submit();" class="btn btn-primary radius" type="submit">
                <i class="Hui-iconfont">&#xe632;</i> 保存
            </button>
            {else /}
            <input type="hidden" value="{$result.id}" id="intro_id"/>
            <button onClick="strategy_edit_submit();" class="btn btn-primary radius" type="submit">
                <i class="Hui-iconfont">&#xe632;</i> 修改
            </button>
            {/empty}
            <button class="btn btn-secondary radius" type="reset"><i class="Hui-iconfont">&#xe632;</i>取消</button>
        </div>
    </div>
</form>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="__STATIC__/template/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/layer/2.4/layer.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__STATIC__/template/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="__STATIC__/template/lib/laypage/1.2/laypage.js"></script>
<!-- 加载js -->
{load file='_LIB_/jquery-2.1.4.js'}
{load file='_LIB_/fastclick.js'}
{load file='_JS_/jquery.Spinner.js'}
{load file='_JS_/jquery-weui.js'}
{load file='_LIB_/diyUpload.js'}
{load file='_LIB_/webuploader.min.js'}

<script type="text/javascript">
    /*视频上传*/
    var video = "";
    var video_del = $('#video_del').attr('data-video');
    if(video_del==''||video_del==null||video_del==undefined){
        $('#video_tip').show();
        $("#video").diyUpload({
            url:"{:url('admin/Uploads/video')}",
            // 开起分片上传。 thinkphp的上传类测试分片无效,图片丢失;
            chunked:true,
            //最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
            fileNumLimit:1,
            fileSizeLimit:1024 * 1024*30,
            fileSingleSizeLimit:1024 * 20480,
            chunkSize:1024 * 102400,
            //按钮容器;
            pick:{
                id:'#video',
                label:"上传视频"
            },
            //类型限制;
            accept:{
                title:"Video",
                extensions:"wmv,mp4",
                mimeTypes:"video/*"
            },
            success:function( data ) {
                console.log( data );
                if(data.ok){
                    video=data.video;
                    $('#video_tip').text(data.msg).css('color','green');
                }else{
                    $('#video_tip').text(data.msg).css('color','red');
                }

            },
            error:function( err ) {
                console.log( err.msg );
                if(err.ok==false){
                    $('#video_tip').text(err.msg).css('color','red');
                }

            }
        });
    }

    /*视频添加*/
    function strategy_save_submit(){
        var title = $.trim($('#title').val());
       // alert(video);
        var url   = "{:url('admin/System/intro_add')}";
        $.post(url,{ title:title,video:video },function(res){
            console.log(res);
            if(res.ok){
                layer.msg(res.msg,{icon:1,time:1000});
            }else{
                layer.msg(res.msg,{icon:5,time:1000});
            }
        })
    }
    /* 视频删除显示*/
    function videoDel(obj){
        $(obj).parent().remove();
        $('#video_tip').show();
        $("#video").diyUpload({
            url:"{:url('admin/Uploads/video')}",
            // 开起分片上传。 thinkphp的上传类测试分片无效,图片丢失;
            chunked:true,
            //最大上传的文件数量, 总文件大小,单个文件大小(单位字节);
            fileNumLimit:1,
            fileSizeLimit:1024 * 1024*30,
            fileSingleSizeLimit:1024 * 20480,
            chunkSize:1024 * 102400,
            //按钮容器;
            pick:{
                id:'#video',
                label:"上传视频"
            },
            //类型限制;
            accept:{
                title:"Video",
                extensions:"wmv,mp4",
                mimeTypes:"video/*"
            },
            success:function( data ) {
                console.log( data );
                if(data.ok){
                    video=data.video;
                    $('#video_tip').text(data.msg).css('color','green');
                }else{
                    $('#video_tip').text(data.msg).css('color','red');
                }

            },
            error:function( err ) {
                console.log( err.msg );
                if(err.ok==false){
                    $('#video_tip').text(err.msg).css('color','red');
                }

            }
        });
    }

    /* 修改 */
    function strategy_edit_submit(){
        var id = $.trim($('#intro_id').val());
        var title = $.trim($('#title').val());
        var videoDel = $.trim($('#videoDel').attr('data-video'));
        var video1 = '';
        if(videoDel==''||videoDel==null||videoDel==undefined){
            video1 = video;
        }else{
            video1 = videoDel;
        }
        var url   = "{:url('admin/System/intro_edit')}";
        $.post(url,{ title:title,video:video1,id:id },function(res){
            console.log(res);
            if(res.ok){
                layer.msg(res.msg,{icon:1,time:1000});
            }else{
                layer.msg(res.msg,{icon:5,time:1000});
            }
        })
    }


    /*攻略-删除*/
    function strategy_del(obj,id){
        layer.confirm('删除后不可恢复，确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: '{:url(\'intro_del\')}',
                data: { id:id },
                dataType: 'json',
                success: function(data){
                    console.log(data);
                    if(data.ok){
                        $(obj).parents("tr").remove();
                        setTimeout("window.location.replace(location.href)",1000);
                        layer.msg(data.msg,{icon:1,time:1000});
                    }
                },
                error:function(data) {
                    console.log(data.msg);
                    layer.msg(data.msg,{icon:5,time:1000});
                },
            });
        });
    }





</script>
</body>
</html>